package com.mszlu.blog.controller;

import com.mszlu.blog.service.TagService;
import com.mszlu.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Jiang Yizhi
 * @Date: 2022/3/26 11:23 AM
 */
@RestController
@RequestMapping("tags")
public class TagsController {

    @Autowired
    private TagService tagService;

    @GetMapping("hot") /** /tags/hot */
    public Result hot() {
        int limit = 6;
        return tagService.hots(limit);
    }

    @GetMapping
    public Result getAll() {
        return tagService.getAll();
    }

    @GetMapping("detail")
    public Result getAllDetail() {
        return tagService.getAllDetail();
    }

    @GetMapping("detail/{id}")
    public Result getTagDetailById(@PathVariable("id") Long id) {
        return tagService.getTagDetailById(id);
    }
}
